<script>
import apiEmp from "@/pages/v1/mes/Emp/js/apiEmp";

export default {
  name: 'EmpHolder',
  props: {
    value:"",
    emp:{}
  },
  data() {
    return {
      inSideValue:""
    }
  },
  methods:{
    getEmp(){
      apiEmp.findBy({_where:{card:this.inSideValue}},(res)=>{
        if (res.length === 0){
          this.$toast.error("未找到员工")
        }else {
          this.$emit("update:emp",res[0])
          this.inSideValue = ""
        }
      })
    }
  }
}
</script>

<template>
<div class="flcc">
  <mu-text-field @keydown.enter="getEmp" v-model="inSideValue" label-float label="员工条码扫描" action-icon="qr_code"></mu-text-field>
</div>
</template>

<style scoped>

</style>